package com.nineyang.aop;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

/**
 * ClassName:LogAspect
 * Description:
 * author: jiuyang
 * DateTime: 2025/1/16 下午5:19
 */
@Component
@Aspect
public class LogAspect {

    private static final Logger LOGGER = LoggerFactory.getLogger(LogAspect.class);

    @Pointcut("execution(* com.nineyang.service..*(..))")
    public void serviceMethod(){

    }


    @Before("serviceMethod()")
    public void sysLog(JoinPoint joinPoint) {
        String name = joinPoint.getSignature().getName();
        Object[] args = joinPoint.getArgs();
        LOGGER.info("方法[{}]执行，参数[{}]",name,args);
    }

}
